5-E
Simple site for the info you need...
$sent = "Email sent"
$emailerror = "Email was not sent"
function sendMail{
Write-Host "Sending Email"
$smtpServer = "SMTPserver.domain.local"
$msg = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
#Email structure
$msg.From = "NoReply@domain.com"
$msg.ReplyTo = "ServerAdmin@domain.com"
$msg.To.Add("Distrobution@domain.com")
$msg.subject = "Email Subject"
$msg.body = "Email Body"
#Sending email
$smtp.Send($msg)
}
Try {sendMail
$sent >>Email.log}
catch {$emailerror >>Email.log}